package com.echo.im.platform.controller;

import com.echo.im.common.vo.message.PrivateMessageVO;
import com.echo.im.common.vo.message.SystemMessageVO;
import com.echo.im.platform.core.common.Result;
import com.echo.im.platform.core.dto.PullOfflineMessageDto;
import com.echo.im.platform.service.SystemMessageService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: echo
 * @time: 2024-08-14
 */
@Slf4j
@Component
@Controller
@RequestMapping("/message/system")
@RequiredArgsConstructor
public class SystemMessageController {

    private final SystemMessageService systemMessageService;

    @GetMapping("/pullOfflineMessage")
    @Operation(summary = "拉取离线消息", description = "拉取离线消息,消息将通过webscoket异步推送")
    public Result<List<SystemMessageVO>> pullOfflineMessage(@RequestParam PullOfflineMessageDto dto) throws InterruptedException {
        List<SystemMessageVO> systemMessageVOList = systemMessageService.pullOfflineMessage(dto);
        return Result.success(systemMessageVOList);
    }

}
